package demo2;

class B{
    public B() {//第二步
        func();//动态绑定
    }

    public void func(){
        System.out.println("B::func()");
    }
}

class D extends B{

    public D(){//第四步

    }
    private int num=1;//第五步

    public void func() {//第三步
        System.out.println("D::func()" + num);//第六步
    }
}

public class Test {
    public static void main(String[] args) {
        D d=new D();//第一步
        d.func();
    }
}
